package cn.stylefeng.guns.modular.tao.api;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

@Slf4j
@RequestMapping("/api")
public class ApiController {

    //    @Scheduled(cron = "0 0 5 * * ? *")
    @RequestMapping("/test")
    public void updateStock() throws Exception {
//        String timestamp = null;
//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        //1、通过Date类获取系统当前时间
//        timestamp = df.format(new Date());
//        //获取token
//        ApiGetToken apiGetToken = new ApiGetToken();
//        String token = apiGetToken.DoGetToken();
//        //获取sign
//        Map<String, String> map = Map.of("appkey", Config.appkey, "timestamp", timestamp, "token", token, "method", "zyx.selfbuiltmall.batchquerysaleqty", "numids", "", "shopkey", Config.shop_key, "ktypeids", "");
//        AESCoder aesCoder = new AESCoder();
//        String sign = aesCoder.SignRequest(map, Config.sign_key);
//        //登录凭证校验
//        String url = "http://ca.mygjp.com:8002/api/";
//        String param = "shopkey=" + Config.shop_key + "&numids=%5b%22110890-9001%22%2c%221108909001%22%5d&eshopid=0&iscalcsaleqty=false&ktypeids=null&pageno=0&pagesize=0&method=beefun.selfbuiltmall.batchquerysaleqty&appkey=" + Config.appkey + "&timestamp=" + timestamp + "&token=" + token + "&sign=" + sign + "";
//
//        String result = HttpRequest.sendPost(url,param);
//        System.out.println(result);

    }
}
